package com.yuyu.service.impl;

import com.yuyu.bean.Classify;
import com.yuyu.bean.PageData;
import com.yuyu.bean.PageDataOfMybatis;
import com.yuyu.bean.ResultData;
import com.yuyu.mapper.ClassifyMapper;
import com.yuyu.service.ClassifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("classifyService")
@Transactional
public class ClassifyServiceImpl implements ClassifyService {
    @Autowired
    private ClassifyMapper classifyMapper;

    @Override
    public int addClassify(Classify classify) {
        int result = classifyMapper.addClassify(classify);
        return result;
    }

    @Override
    public List<Classify> findAllClassify() {
        List<Classify> classifies = classifyMapper.findAllClassify();
        return classifies;
    }

    @Override
    public int deleteClassify(Integer code) {
        int result = classifyMapper.deleteClassifyByCode(code);
        return result;
    }

    @Override
    public Integer getLastInsertCode() {
        return classifyMapper.getLastInsertCode();
    }

    @Override
    public List<Classify> getOnePageList(PageDataOfMybatis pageDataOfMybatis) {
        return classifyMapper.getOnePageList(pageDataOfMybatis);
    }

    @Override
    public Integer getCowsCount() {
        Integer cowsCount = classifyMapper.getCowsCount();

        System.out.println("cowsCount = "+cowsCount);
        return  cowsCount;
    }

    @Override
    public Integer deleteClassifys(List<Integer> list) {
        return classifyMapper.deleteClassifys(list);
    }


}
